package com.briup.recognition.web.controller;


import com.briup.recognition.bean.Application;
import com.briup.recognition.service.IApplicationService;
import com.briup.recognition.utils.Message;
import com.briup.recognition.utils.MessageUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/application")
public class ApplicationController {

    @Autowired
    private IApplicationService applicationService;

   @GetMapping("query")
    public Message query(){
       List<Application> list = applicationService.query();
       return MessageUtil.success(list);
   }

   @PostMapping("saveOrUpdate")
    public Message saveOrUpdate(Application application){
       applicationService.saveOrUpdate(application);
       return MessageUtil.success("操作成功");
   }

   @DeleteMapping("deleteById")
    public Message deleteById(long id){
       applicationService.deleteById(id);
       return MessageUtil.success("删除成功");
   }

}
